import Vue from 'vue';
import Router from 'vue-router';
import Home from '@/components/common/Home.vue';

Vue.use(Router);

export default new Router({
    // mode: 'history',
    routes: [
        {
            path: '/',
            redirect: '/user'
        },
        {
            path: '/',
            component: Home,
            meta: { title: '自述文件' },
            children:[
                {
                    path: '/user',
                    component: () => import('@/components/page/User/UserList.vue'),
                    meta: { title: '用户管理' }
                },
                {
                    path: '/goodsEntity',
                    component: () => import('@/components/page/goodsEntity.vue'),
                    meta: { title: '商品管理' }
                },
                {
                    path: '/goodsCommit',
                    component: () => import('@/components/page/goodsCommit.vue'),
                    meta: { title: '商品评论管理' }
                },
                {
                    path: '/msgEntity',
                    component: () => import('@/components/page/msgEntity.vue'),
                    meta: { title: '公告类信息管理' }
                },
                {
                    path: '/msgCommit',
                    component: () => import('@/components/page/msgCommit.vue'),
                    meta: { title: '公告评论管理' }
                }
            ]
        },
        {
            path: '/login',//登录
            component: () => import('@/components/page/Login.vue')
        },
        {
            path: '/404',//找不到页面
            component: () => import('@/components/page//Error/404.vue')
        },
        {
            path: '/403',//无权限
            component: () => import('@/components/page/Error/403.vue')
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
})
